#include "common.hpp"

template<class T>
void reader(T* addr)
{

    SyncLast sync;
    sync.CreatePipe();
    sync.ROpen();

    for(;;)
    {
        if(!sync.Wait()) break;

        cout << addr << endl;
    }
}


int main()
{
    
    shm shared_memory;
    shared_memory.create_shm();
    shared_memory.shm_attach();

    reader((char*)shared_memory.get_addr());

    shared_memory.shm_detach();
    shared_memory.close_shm();

    return 0;
}